package com.data.modules.bpm.redis;

import lombok.extern.slf4j.Slf4j;
import org.camunda.bpm.engine.impl.persistence.deploy.cache.CacheFactory;
import org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache;
import org.camunda.commons.utils.cache.Cache;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;

/**
 * <p>Provides the default cache implementation for the deployment caches see {@link DeploymentCache}.</p>
 *
 * @author CG
 */
@Slf4j
@Component("com.data.modules.bpm.redis.RedisCacheFactory")
public class RedisCacheFactory implements CacheFactory {
    @Autowired
    @Lazy
    private ConcurrentLruRedis lruRedis;
    
    public RedisCacheFactory(){
        log.info("init--RedisCacheFactory");
    }
    
    @Override
    public <T> Cache<String, T> createCache(int maxNumberOfElementsInCache) {
        return lruRedis;
    }
}